package com.hxd.otc.api;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.order.bean.AliyunBean;
import com.hxd.otc.module.order.bean.AllOrderBean;
import com.hxd.otc.module.order.bean.AppealBean;
import com.hxd.otc.module.order.bean.BankInfoPoData;
import com.hxd.otc.module.order.bean.ComplainTypeBean;
import com.hxd.otc.module.order.bean.RedPointBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * 作  者 :  zjl
 * 时  间 :  2018/6/12 17:19
 * 描  述 :  ${订单接口}
 */
public interface IOrderApi {

    /**
     * @param status      status=0   (不传是全部，0未付款，1已付款，2已完成，9取消)
     * @param currentPage
     * @param showCount
     * @return
     */
    @POST("otc/detail/findbystatus")
    Observable<BaseBean<AllOrderBean>> getOrderList(@Query("status") int status,
                                                    @Query("current") int currentPage,
                                                    @Query("size") int showCount);

    @POST("otc/detail/findbystatus")
    Observable<BaseBean<AllOrderBean>> getOrderList(@Query("current") int currentPage,
                                                    @Query("size") int showCount);

    @GET("otc/detail/{subOrderId}")
    Observable<BaseBean<AllOrderBean.DataBean>> getOrderDetail(@Path("subOrderId") String subOrderId);

    @POST("otc/detail/cancel")
    Observable<BaseBean> cancleOrder(@Query("subOrderId") String subOrderId);

    @POST("otc/easypay/detail/cancel")
    Observable<BaseBean> cancleEasyPayOrder(@Query("subOrderId") String subOrderId);

    @POST("otc/buy/confirm")
    Observable<BaseBean> paidOrder(@Query("subOrderId") String subOrderId
            , @Query("confirmPaymentName") String confirmPaymentName
            , @Query("supportPay") String supportPay
    );

    @POST("otc/easypay/buy/confirm")
    Observable<BaseBean> paidEasePayOrder(@Query("subOrderId") String subOrderId
            , @Query("confirmPaymentName") String confirmPaymentName
            , @Query("supportPay") String supportPay
    );

    @POST("otc/sell/confirm")
    Observable<BaseBean> receiveOrder(@Query("subOrderId") String subOrderId);


    /**
     * 部分确认收款
     *
     * @param subOrderId
     * @return
     */
    @POST("otc/easypay/sell/confirm")
    Observable<BaseBean> partConfirmOrder(@Query("subOrderId") String subOrderId, @Query("totalPrice") String totalPrice);

    @GET("otc/orderpay/{subOrderId}")
    Observable<BaseBean<List<BankInfoPoData>>> getOrderBankList(@Path("subOrderId") String subOrderId);

    @GET("otc/detail/count")
    Observable<BaseBean<RedPointBean>> redPointFlag();

    // 申诉
    @POST("otc/appeal/doappeal")
    Observable<BaseBean> complainAppeal(@Query("subOrderId") String subOrderId,
                                        @Query("appealType") String appealType,
                                        @Query("reason") String reason,
                                        @Query("pic") String pic);

    //取消申诉
    @POST("otc/appeal/cancel")
    Observable<BaseBean> cancleAppeal(@Query("appealId") String appealId);

    //申诉列表
    @GET("otc/appeal/findall")
    Observable<BaseBean<List<AppealBean>>> getAppealList();


    @PUT("order/recall/{id}")
    Observable<BaseBean> recallOrder(@Path("id") String id);

    @GET("order/appeal/type")
    Observable<BaseBean<List<ComplainTypeBean>>> complainType();


    @GET("oss/ossInfo")
    Observable<BaseBean<AliyunBean>> getOssInfo();

    @GET("ping")
    Observable<BaseBean> ping();
}
